package at.spengergasse.abifs.SDJPATest.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import at.spengergasse.abifs.SDJPATest.model.Coach;
import at.spengergasse.abifs.SDJPATest.repository.CoachRepository;

@Service("coachService")
public class CoachServiceImpl implements CoachService
{
	
	@Autowired
	private CoachRepository coachRepository;

	@Override
	@Transactional
	public void save(Coach coach) 
	{
		coachRepository.save(coach);
	}

	@Override
	@Transactional
	public void delete(Coach coach) 
	{
		coachRepository.delete(coach);
	}

	@Override
	@Transactional(readOnly=true)
	public Coach findByID(Long c_id) 
	{
		return coachRepository.findByID(c_id);
	}

	@Override
	@Transactional(readOnly=true)
	public List<Coach> findAllCoaches() 
	{
		return coachRepository.findAll();
	}
	
}
